/*
	ScannerRuleIMPL

	define implement class of CScannerRule

	@author Wolfhead

*/
#pragma once
#include "ScannerRule.h"
#include <map>
#include <set>
#include <hash_map>
#include <string>
#include "KeyWordNode.h"



class CScannerRule::IMPL
{
public:
	IMPL();
	~IMPL();

public:
	int RegisterSpetialToken(const char* pToken, int Type);
	int RegisterSkipSpaceFunc(SkipSpaceFunc func);
	int RegisterNumberScanFunc(NumberScanFunc func);
	int RegisterWordScanFunc(WordScanFunc func);
	int RegisterKeyWord(const char* pKeyWord, int Type);
	int RegisterStringScanFunc(StringScanFunc func);

	void SkipSpace( CCodePtr pCode );
	CTerminateTokenPtr ScanSpetialToken(CCodePtr pCode);
	CTerminateTokenPtr ScanNumber(CCodePtr pCode);
	CTerminateTokenPtr ScanWord(CCodePtr pCode);
	CTerminateTokenPtr ScanString(CCodePtr pCode);

private:

	int GetKeyWord(const std::string& strKeyword);


private:
	CKeyWordNodePtr m_KeyMap;
	std::set<char> m_whiteSpace;
	stdext::hash_map<std::string,int> m_KeyWordHash;

	SkipSpaceFunc m_SkipSpaceFunc;
	NumberScanFunc m_NumberScanFunc;
	WordScanFunc m_WordScanFunc;
	StringScanFunc m_StringScanFunc;
};
